﻿using System;
using ExtendedConsole;   // add ExtendedConsole.dll  project's references for this to work

namespace ProjectMain
{

    /// Class Mask PassWord 
    /// 
     public class PwdMaskClass
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            public static string PasswdMask()
            {
                
                ConsoleEx c = new ConsoleEx();
                c.SetMode(ConsoleEx.InputMode.EchoInput);
                int chr = 0;
                string pass = "";
                const int ENTER = 13;
                do
                {
                    chr = Console.Read();
                    Console.Write('*');
                    pass += (char)chr;
                } while (chr != ENTER);

                
        // Change back the input-mode to line input

        c.SetMode(ConsoleEx.InputMode.LineInput);
        c.Clear();

        return pass;
       }
        }
    }

